<?php

namespace app\course\event\listeners\course;

use app\common\event\subscribes\notify\Notify;
use think\facade\Event;

/**
 * 课程购买通知
 */
class CoursePurchase
{
    public static function handle($param)
    {
        $param = [
            'user' => $param['user_id'],
            'type' => 'system_notify',
            'key'  => 'course_purchase',
            'var'  => [
                'user_name'    => $param['user_name'],
                'course_title' => $param['course_title']
            ],
        ];
        // Db::name('test')->save(['msg'=>json_encode($param)]);
        Event::subscribe(Notify::class);
        Event::trigger('Notify', $param);
    }
}
